<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">

    <title>慕课网2015课程学习情况</title>

    <style type="text/css">
        body{
            margin: 0;
            padding: 0;
        }
        .component{
            width: 50%;
            height: 50px;
            margin-bottom: 20px;
            background-color: #eee;
            display: none;
        }
    </style>

    <script type="text/javascript" src="../js/lib/jquery.js"></script>
    <script type="text/javascript" src="../js/lib/jquery-ui.min.js"></script>
    <script type="text/javascript" src="../js/lib/jquery.fullPage.js"></script>

    <script type="text/javascript">

        $(function (){
            $('#h5').fullpage({
                'sectionColor':['#254875','#00ff00','#66666','#333333'],
            onLeave:function(index,nextIndex,direction){
                $('#h5').find('.page').eq(index-1).trigger('onLeave');

            },
            afterLoad:function(anchorLink,index){
                $('#h5').find('.page').eq(index-1).trigger('onLoad');

            }
        });

            $('.page').on('onLeave',function(){
                console.log($(this).attr('id'),'===>','onLeave');
                $(this).find('.component').trigger('onLeave');
            });
            $('.page').on('onLoad',function(){
                console.log($(this).attr('id'),'===>','onLoad');
                $(this).find('.component').trigger('onLoad');
            });

            $('.component').on('onLeave',function(){
               $(this).fadeOut();
                return false;

            });
            $('.component').on('onLoad',function(){
                $(this).fadeIn();
                return false;
            });

        });



    </script>

<body>
<!-- 用于验证 fullpage.js 切换页面，以及内容组织结构可用，组件能够进行动画 -->

<div id="h5">
    <div class="page section" id="page-1">
        <div class="component logo">
            logo
        </div>
        <div class="component slogan">
            slogan
        </div>
    </div>
    <div class="page section" id="page-2">
        <div class="component desc">
            desc
        </div>
    </div>
    <div class="page section" id="page-3">
        <div class="component bar">
            柱状图
        </div>
    </div>


</div>

</body>

</html>